package com.example.demo.annotion;

/**
 * @Description AnnotationTest4
 * @Author songchuanlong
 * @Date 2025-06-11
 */

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * Juint测试框架设计
 */
public class AnnotationTest4 {
//    @MyTest03
    public void test1(){
        System.out.println("==========test1==========");
    }

    @MyTest03
    public void test2(){
        System.out.println("==========test2==========");
    }

//    @MyTest03
    public void test3(){
        System.out.println("==========test3==========");
    }

    @MyTest03
    public void test4(){
        System.out.println("==========test4==========");
    }

    /**
     * main函数作为启动按钮
     * @param args
     */
    public static void main(String[] args) throws Exception {
        AnnotationTest4 annotationTest4 = new AnnotationTest4();
        //对于有注解的
        Class c = AnnotationTest4.class;
        Method[] declaredMethods = c.getDeclaredMethods();
        for (Method declaredMethod : declaredMethods) {
            if(declaredMethod.isAnnotationPresent(MyTest03.class)){
                declaredMethod.invoke(annotationTest4);
            }
        }
    }
}
